import request from '@/utils/request'

/**
 * 1.获取所有的权限列表
 */
export const getPermissionList = () => {
  return request({
    url: '/sys/permission'
  })
}

/**
 * 2.添加权限
 */
export const addPermission = data => {
  return request({
    url: '/sys/permission',
    method: 'post',
    data
  })
}

/**
 * 3. 删除权限(根据id)
 */
export const removePermission = id => {
  return request({
    url: `/sys/permission/${id}`,
    method: 'delete'
  })
}

/**
 * 4.获取权限详情(根据id)
 */
export const getPermissionDetail = id => {
  return request({
    url: `/sys/permission/${id}`
  })
}

/**
 * 5.更新权限详情(根据id)
 */
export const updatePermissionDetail = data => {
  return request({
    url: `/sys/permission/${data.id}`,
    method: 'put',
    data
  })
}
